package suse.hotel.admin.admin.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import suse.hotel.admin.admin.DTO.AdminDTO;
import suse.hotel.admin.admin.Mapper.AdminMapper;
import suse.hotel.admin.admin.Provider.JsonProvider;

import java.util.List;

@Service
public class AdminService {
    @Autowired
    AdminMapper adminMapper;
    @Autowired
    JsonProvider jsonProvider;

    public String selAdmins(int page,int limit){
        PageHelper.startPage(page,limit);
        List<AdminDTO> adminDTOS = adminMapper.selAdmin();
        PageInfo<AdminDTO> pageInfo=new PageInfo<>(adminDTOS);
        return jsonProvider.toJson(pageInfo);
    }
}
